package com.hometeacher.api.service;

import com.hometeacher.api.model.Orders;
import com.hometeacher.api.model.User;
import com.hometeacher.api.repository.OrderRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZhaoYuan
 * @data 06/05/2020 23:42
 */
@Service
@Slf4j
public class OrderService {

    @Autowired
    OrderRepository orderRepository;

    public List<Orders> findAllOrderByStu(Long stu_id){

        return orderRepository.findAllByStuID(stu_id);
    }

    public List<Orders> findAllOrderByTeacher(Long teacher_id){

        return orderRepository.findAllByTeacherID(teacher_id);
    }

    public Orders confirm(Orders orders){
        return orderRepository.save(orders);
    }


}
